<?php

use yii\db\Migration;

/**
 * Handles the creation of table `project_single`.
 */
class m180402_091008_create_project_single_table extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $this->createTable('project_single', [
            'id' => $this->primaryKey(),
            'level' => $this->smallInteger()->notNull()->comment('评级'),
            'title' => $this->string()->notNull()->comment('项目名称'),
            'province' => $this->integer()->notNull()->comment('省份'),
            'city' => $this->integer()->notNull()->comment('城市'),
            'category' => $this->smallInteger()->notNull()->comment('分类'),
            'tag' => $this->text()->notNull()->comment('标签'),
            'creditor' => $this->string()->notNull()->comment('项目持有方'),
            'detail' => $this->text()->notNull()->comment('项目情况'),
            'asset' => $this->text()->notNull()->comment('涉及资产情况'),
            'address' => $this->string()->notNull()->comment('地址'),
            'area' => $this->decimal(10, 2)->notNull()->comment('面积'),
            'price' => $this->decimal(20, 2)->notNull()->comment('项目卖价'),
            'price_per_area' => $this->decimal(20, 2)->notNull()->comment('市场单价'),
            'price_pre_evaluate' => $this->decimal(20, 2)->notNull()->comment('预估市场价值'),
            'evaluate_by' => $this->text()->notNull()->comment('评估依据'),
            'highlights' => $this->text()->notNull()->comment('亮点介绍'),
            'contact' => $this->text()->notNull()->comment('联系人情况及联系方式'),
            'history' => $this->text()->notNull()->comment('沟通情况'),
            'follow' => $this->text()->notNull()->comment('跟进方向'),
            'source' => $this->text()->notNull()->comment('网址链接'),
            'owner' => $this->integer()->notNull()->comment('上传人'),
            'created_at' => $this->dateTime()->notNull()->comment('创建时间'),
            'updated_at' => $this->timestamp()->notNull()->comment('更新时间'),
        ]);
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('project_single');
    }
}
